#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>

/**
 * @brief 阻塞式读取值
 * 
 * @param argc 
 * @param argv 
 * @return int 
 */

int main(int argc,char **argv)
{
    int fd;
    char val;

    fd = open("/dev/eint_key", O_RDONLY);
    if (fd < 0) {
        printf("open failed \n");
        return -1;
    }

    while (1) {
        read(fd, &val, 1);
        printf("val = %x\n", val);
    }

    close(fd);

    return 0;
}